import 'package:serverpod_auth_idp_server/core.dart';

import '../providers/passkey/passkey.dart';

/// AuthServices factory for creating [PasskeyIDP] instances.
class PasskeyIdentityProviderFactory
    extends IdentityProviderFactory<PasskeyIDP> {
  /// The configuration for the Passkey identity provider.
  final PasskeyIDPConfig config;

  /// Creates a new [PasskeyIdentityProviderFactory].
  PasskeyIdentityProviderFactory(
    this.config,
  );

  @override
  PasskeyIDP construct({
    required final TokenManager tokenManager,
    required final AuthUsers authUsers,
    required final UserProfiles userProfiles,
  }) {
    return PasskeyIDP(
      config,
      tokenIssuer: tokenManager,
      authUsers: authUsers,
    );
  }
}
